package cn.drenal.capcap.entity;

import cn.drenal.capcap.entity.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tangzc.autotable.annotation.ColumnComment;
import com.tangzc.autotable.annotation.ColumnDefault;
import com.tangzc.autotable.annotation.ColumnNotNull;
import com.tangzc.autotable.annotation.Index;
import com.tangzc.mpe.annotation.InsertFillTime;
import com.tangzc.mpe.annotation.InsertUpdateFillTime;
import com.tangzc.mpe.autotable.annotation.*;
import com.tangzc.mpe.processer.annotation.AutoDefine;
import com.tangzc.mpe.processer.annotation.AutoMapper;
import com.tangzc.mpe.processer.annotation.AutoRepository;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

/**
 * 通知表
 */
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper
@Table(comment = "通知表")
public class Notification extends BaseEntity {
    @ColumnComment("主键")
    @ColumnId(mode = IdType.AUTO)
    private Long id;

    @ColumnComment("接收用户ID")
    @ColumnNotNull
    @Index
    private String userId;

    @ColumnComment("通知类型：1-系统通知，2-作品审核，3-评论通知，4-收藏通知，5-活动通知")
    @ColumnNotNull
    private Integer type;

    @ColumnComment("通知标题")
    @ColumnNotNull
    private String title;

    @ColumnComment("通知内容")
    @ColumnNotNull
    @Column(length = 500)
    private String content;

    @ColumnComment("关联ID，根据通知类型关联不同的表")
    private String relatedId;

    @ColumnComment("是否已读：0-未读，1-已读")
    @ColumnNotNull
    @ColumnDefault("0")
    private Integer isRead;

    @ColumnComment("阅读时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime readTime;


}